package com.xxx.video.mine.fragments;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.xxx.video.R;
import com.xxx.video.commen.adapters.BaseRecycleViewAdapter;
import com.xxx.video.commen.adapters.BaseViewHolder;
import com.xxx.video.commen.views.TagAdapter;
import com.xxx.video.commen.views.TagLayout;
import com.xxx.video.mine.adapters.SearchHotWordListAdapter;
import com.xxx.video.mine.beans.SearchHotWordListBean;

import butterknife.BindView;

public class SearchHotSearchListAdapter extends BaseRecycleViewAdapter<SearchHotWordListBean.ListBean, SearchHotSearchListAdapter.MyHolder> {

    public SearchHotSearchListAdapter(@NonNull Context context) {
        super(context);
    }

    @Override
    public MyHolder onCreateDefaultViewHolder(View view, int viewType) {
        return new MyHolder(view);
    }

    @Override
    public int getItemLayout(int viewType) {
        return R.layout.item_search_hot_search_list;
    }

    @Override
    public int getItemCount() {
        return 1;
    }

    class MyHolder extends BaseViewHolder {
        @BindView(R.id.tv_item_search_recommend_list_hot_search_tile)
        TextView tvItemSearchRecommendListHotSearchTile;
        @BindView(R.id.tl_item_search_recommend_list_hot_search_list)
        TagLayout tlItemSearchRecommendListHotSearchList;

        public MyHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void setData2View(int position) {
            SearchHotWordListAdapter searchHotWordListAdapter = new SearchHotWordListAdapter(data);
            tlItemSearchRecommendListHotSearchList.setAdapter(searchHotWordListAdapter);
            searchHotWordListAdapter.setOnItemClickListener((TagAdapter.OnItemClickListener<SearchHotWordListBean.ListBean>) (listBean, position1, type) -> {
                if (onItemClickListener != null) {
                    onItemClickListener.onItemClick(listBean, position, 2);
                }
            });
        }
    }
}
